Add gtk_settings_reset_property
authorMatthias Clasen <mclasen@redhat.com>
Thu, 17 Sep 2015 23:13:39 +0000 (19:13 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 4 Oct 2015 02:42:12 +0000 (22:42 -0400)
This api undoes an application-specific override and makes the
setting follow the system-wide values again.

https://bugzilla.gnome.org/show_bug.cgi?id=755008

docs/reference/gtk/gtk3-sections.txt
gtk/gtksettings.c
gtk/gtksettings.h

index e9c8ddc333d3e8d6f3fc1fc992e12fad38f428cd..60d3eb84497a468901d57943a17f5f50ba24f733 100644 (file)
@@ -3294,6 +3294,7 @@ gtk_settings_set_property_value
 gtk_settings_set_string_property
 gtk_settings_set_long_property
 gtk_settings_set_double_property
+gtk_settings_reset_property
 GtkIMPreeditStyle
 GtkIMStatusStyle
 <SUBSECTION Standard>
index cc74a0628798fe8af590305fa84e0c447cadbc5d..e4e91fb09576e577c9a81ca603bfdcea94ae2f61 100644 (file)
@@ -3395,3 +3395,31 @@ _gtk_settings_get_setting_source (GtkSettings *settings,
 
   return priv->property_values[pspec->param_id - 1].source;  
 }
+
+/**
+ * gtk_settings_reset_property:
+ * @settings: a #GtkSettings object
+ * @name: the name of the setting to reset
+ *
+ * Undoes the effect of calling g_object_set() to install an
+ * application-specific value for a setting. After this call,
+ * the setting will again follow the session-wide value for
+ * this setting.
+ *
+ * Since: 3.20
+ */
+void
+gtk_settings_reset_property (GtkSettings *settings,
+                             const gchar *name)
+{
+  GtkSettingsPrivate *priv = settings->priv;
+  GParamSpec *pspec;
+
+  pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (settings), name);
+
+  g_return_if_fail (pspec != NULL);
+
+  g_param_value_set_default (pspec, &priv->property_values[pspec->param_id - 1].value);
+
+  priv->property_values[pspec->param_id - 1].source = GTK_SETTINGS_SOURCE_DEFAULT;
+}
index 95fe638937fd0e4cb267adc9b05ed4dcfb8cfbc0..4b05a8b06c76e687e2be518b614b3116c6723d37 100644 (file)
@@ -140,6 +140,9 @@ void     gtk_settings_set_double_property  (GtkSettings            *settings,
                                             gdouble                 v_double,
                                             const gchar            *origin);
 
+GDK_AVAILABLE_IN_3_20
+void     gtk_settings_reset_property       (GtkSettings            *settings,
+                                            const gchar            *name);
 
 G_END_DECLS